<template>
  <mars-dialog
    title="应急专业服务队详情"
    customClass="base-pannel two-row-form"
    width="60%"
    top="40%"
    left="20%"
    height="55%"
  >
    <div class="form-container">
      <div class="form-card">
        <!-- 标题行 -->
        <div class="header-row">
          <div class="header-item">服务区域</div>
          <div class="header-item">服务队联系人</div>
          <div class="header-item">服务队联系电话</div>
          <div class="header-item">服务队总人数</div>
          <div class="header-item">服务队所在乡镇</div>
          <div class="header-item">服务组织名称</div>
        </div>
        <!-- 内容行 -->
        <div class="content-row">
          <div class="content-item">{{ yjzyfwd.fwqy || '未指定' }}</div>
          <div class="content-item">{{ yjzyfwd.fwdlxr || '未指定' }}</div>
          <div class="content-item">{{ yjzyfwd.fwdTel || '未提供' }}</div>
          <div class="content-item">{{ yjzyfwd.fwdrs || 0 }}</div>
          <div class="content-item">{{ yjzyfwd.xz || '未指定' }}</div>
          <div class="content-item">{{ yjzyfwd.name || '未指定' }}</div>
        </div>

        <!-- 装备标题行 -->
        <div class="header-row equipment-header">
          <div class="header-item">主要装备数量</div>
          <div class="header-item">玉米收割机</div>
          <div class="header-item">履带式收割机</div>
          <div class="header-item">小麦联合收割机</div>
        </div>
        <!-- 装备内容行 -->
        <div class="content-row equipment-content">
          <div class="content-item">{{ yjzyfwd.zbsl || '0' }}</div>
          <div class="content-item">{{ yjzyfwd.ymsgj || '0' }}</div>
          <div class="content-item">{{ yjzyfwd.ldsgj || '0' }}</div>
          <div class="content-item">{{ yjzyfwd.lhsgj || '0' }}</div>
        </div>
        <!-- 装备标题行 -->
        <div class="header-row equipment-header">
          <div class="header-item">其他应急装备</div>
          <div class="header-item">播种机械</div>
          <div class="header-item">排灌设备</div>
          <div class="header-item">烘干机</div>
          <div class="header-item">拖拉机</div>

        </div>
        <!-- 装备内容行 -->
        <div class="content-row equipment-content">
          <div class="content-item">{{ yjzyfwd.qtyjzb || '0' }}</div>
          <div class="content-item">{{ yjzyfwd.bzjx || '0' }}</div>
          <div class="content-item">{{ yjzyfwd.pgsb || '0' }}</div>
          <div class="content-item">{{ yjzyfwd.hgj || '0' }}</div>
          <div class="content-item">{{ yjzyfwd.tlj || '0' }}</div>
        </div>
      </div>
    </div>
  </mars-dialog>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue"

import * as mapWork from "@mars/widgets/basic/header/map"



// 定义应急专业服务队数据结构
const yjzyfwd = mapWork.yjstation

// 模拟数据加载
onMounted(() => {
  // 实际项目中可通过API加载数据
  // fetchYjzyfwdData().then(data => yjzyfwd.value = data)
})
</script>

<style lang="less">
// 基础样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", sans-serif;
}

// 透明对话框样式
.mars-dialog {
  .mars-dialog__content {
    background-color: transparent;
    padding: 0;
  }
}

.transparent-dialog {
  .mars-dialog__header {
    background-color: transparent;
    border-bottom: none;
  }
  .mars-dialog__footer {
    background-color: transparent;
    border-top: none;
  }
}

// 表单容器样式（占满对话框）
.form-container {
  width: 100%;
  height: 100%;
  padding: 10px; /* 对话框内边距 */
}

.form-card {
  background-color: transparent;
  border-radius: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px; /* 表单内边距 */

  &::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    z-index: -1;
  }
}

// 两行式表单布局
.two-row-form {
  .header-row, .content-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 0 -5px 10px;
    padding: 10px 0;
    box-sizing: border-box;
  }

  .header-row {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 5px;

    &.equipment-header {
      margin-top: 20px;
    }
  }

  .content-row {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px 0;
  }

  .header-item, .content-item {
    flex: 0 0 calc(100% / 6 - 10px); /* 默认为6列 */
    max-width: calc(100% / 6 - 10px);
    padding: 0 5px;
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    @media (min-width: 1200px) {
      .header-item, .content-item {
        flex: 0 0 calc(100% / 10 - 10px); /* 大屏幕下10列 */
        max-width: calc(100% / 10 - 10px);
      }
    }
  }

  .header-item {
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 0;
  }

  .content-item {
    color: #fff;
    font-size: 14px;
    word-break: break-all;
  }
}

// 对话框头部样式
.mars-dialog .mars-dialog__header {
  background-image: url("/img/panel-header1.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  height: 50px; /* 调整头部高度 */

  .mars-dialog__title {
    color: #fff;
    margin-left: 15px;
    line-height: 50px; /* 垂直居中 */
  }

  .mars-dialog__close {
    color: #fff;
    line-height: 50px; /* 垂直居中 */
  }
}
</style>
